package com.renchunlin.scrollviewlistview.view

import android.content.Context
import android.util.AttributeSet
import android.widget.ListView


/*
 * class title: 
 * Author by RenChunLin, Email 18957806320@163.com, Date on 2021/6/15.
 * PS: Not easy to write code, please indicate.
 */
class MyListView : ListView {
    constructor(context: Context?) : this(context, null)
    constructor(context: Context?, attrs: AttributeSet?) : this(context, attrs, 0)
    constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(
        context,
        attrs,
        defStyleAttr
    )

    override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
        //解决显示不全的问题
        /*
        * 右移两位变成30位的值 30是Int.MAX_VALUE 2位是MeasureSpec.AT_MOST
        * */
        super.onMeasure(
            widthMeasureSpec,
            MeasureSpec.makeMeasureSpec(Int.MAX_VALUE shr 2, MeasureSpec.AT_MOST)
        )
    }
}